<?php

namespace App\Services\Tbk;

use App\Models\PddOrderModel;

class OrderService
{
    public function getPddOrdersByMemberId(int $memberId, int $page, $pageSize)
    {
        $offSet = ($page - 1) * $pageSize;
        $pddOrderModel = new PddOrderModel();
        $list = $pddOrderModel->where([
            'member_id' => $memberId
        ])->orderBy('order_create_time', 'desc')->offset($offSet)->limit($pageSize)->get();
        return $list;
    }

    public function getPddOrderInfoById(int $orderId)
    {
        $pddOrderModel = new PddOrderModel();
        $info = $pddOrderModel->where([
            'id' => $orderId
        ])->first();
        return empty($info) ? (object) [] : $info;
    }
}
